<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function time(i) {
            if (i < 0) {
                alert('输入大于0的数字')
                return
            }
            let h = parseInt(i / 60 / 60 % 24)
            let m = parseInt(i / 60 % 60)
            let s = parseInt(i % 60)
            h = h < 10 ? '0' + h : h
            m = m < 10 ? '0' + m : m
            s = s < 10 ? '0' + s : s
            return `时间转换为 ${h}:${m}:${s}`
        }
        document.write(time(i = +prompt('请输入秒数')))
        // time(i = +prompt('请输入秒数'))
    </script>
</body>

</html>